<template>
  <div>
    <h1>修改承运合同</h1>
    ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
    <el-form ref="form" :model="form" label-width="80px">
      <tr>
        <td>
          <el-form-item label="合同标题:">
            <el-input v-model="form.biaoTi" placeholder="请输入合同标题"></el-input>
          </el-form-item>
        </td>
        <td>
          <el-form-item label="承运单位:">
            <el-input v-model="form.waiXieDanWei" placeholder="请输入承运单位"></el-input>
          </el-form-item>
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item label="承运负责人:">
            <el-input v-model="form.ren" placeholder="请输入承运负责人"></el-input>
          </el-form-item>
        </td>
        <td>
          <el-form-item label="线 路:">
            <el-select v-model="form.xianLu" placeholder="请选择线路" clearable>
              <el-option v-for="item in www" :key="item.id" :label="item.lineTable1" :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item label="吨 运 价:">
            <el-input v-model="form.yunJia" placeholder="请输入吨 运 价"></el-input>
          </el-form-item>
        </td>
        <td>
          <el-form-item label="包车条件吨位:">
            <el-input v-model="form.dunWei" placeholder="请输入包车条件吨位"></el-input>
          </el-form-item>
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item label="包车金额:">
            <el-input v-model="form.jinE" placeholder="请输入包车金额"></el-input>
          </el-form-item>
        </td>
        <td>
          <el-form-item label="经办人:">
            <el-input v-model="form.jinBanRen" placeholder="请输入经办人"></el-input>
          </el-form-item>
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item label="签订时间:">
            <el-col :span="11">
              <el-date-picker type="date" placeholder="选择日期" v-model="form.qianDinDate" style="width: 100%;">
              </el-date-picker>
            </el-col>
          </el-form-item>
        </td>
        <td>
          <el-form-item label="合同金额:">
            <el-input v-model="form.heTongJinE" placeholder="请输入合同金额"></el-input>
          </el-form-item>
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item label="合同标的或项目说明:">
            <el-input v-model="form.heTongBiao" placeholder="请输入合同标的或项目说明"></el-input>
          </el-form-item>
        </td>
      </tr>
      <tr>
        <td>
          <el-form-item label="合同主要条款/变更条款:">
            <el-input v-model="form.tiaoKuan" placeholder="请输入合同主要条款/变更条款"></el-input>
          </el-form-item>
        </td>
      </tr>
      <el-form-item>
        <el-button type="primary" @click="Update">提交</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  data () {
    return {
      form: {
        biaoTi: '',
        waiXieDanWei: '',
        ren: '',
        xianLu: '',
        yunJia: '',
        dunWei: '',
        jinE: '',
        jinBanRen: '',
        qianDinDate: '',
        heTongJinE: '',
        heTongBiao: '',
        tiaoKuan: '',
      },
      www: [],
    }
  },
  created () {
    this.BingXian();
    this.Tian();
  },
  methods: {
    Tian () {
      var ids = localStorage.getItem("kqxq");
      this.$http({
        url: 'https://localhost:44357/api/Car/CarFan',
        method: "get",
        params: {
          id: ids
        }
      }).then((r) => {
        this.form = r.data
      })
    },
    Update () {
      this.$http({
        url: "https://localhost:44357/api/Car/CarUpdate",
        method: "post",
        data: this.form
      }).then((r) => {
        if (r.data = 200) {
          this.$message({
            message: '恭喜你，修改承运合同成功！',
            type: 'success'
          });
          this.$router.push("/CarSel");
        }
      })
    },
    BingXian () {
      this.$http({
        url: "https://localhost:44357/api/Own/Bing",
        method: "get",
      }).then((r) => {
        this.www = r.data;
      })
    },
    onSubmit () {
      console.log('submit!');
    }
  }
}
</script>